import App from './App'
import '@/utils/interceptor.js';//引入拦截

import Vue from 'vue'
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)

import TuniaoUI from '@/uni_modules/tuniao-ui'
Vue.use(TuniaoUI)
import store from './store'


// 注册请求方法
import * as api from '@/api/api.js'
Vue.prototype.$api = api

let vuexStore = require('@/store/$tn.mixin.js')
Vue.mixin(vuexStore)


Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	store,
  ...App
})
app.$mount()

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif

/* 禁止手划,微信小程序端不支持 */
// #ifndef MP-WEIXIN
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
    CSS.supports('top: constant(a)'))
document.write(
    '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
    (coverSupport ? ', viewport-fit=cover' : '') + '" />')

document.documentElement.addEventListener('touchstart', function (event) {
  if (event.touches.length > 1) {
    event.preventDefault();
  }
}, {
  passive: false
});

var lastTouchEnd = 0;
document.documentElement.addEventListener('touchend', function (event) {
  var now = Date.now();
  if (now - lastTouchEnd <= 300) {
    event.preventDefault();
  }
  lastTouchEnd = now;
}, {
  passive: false
});
// #endif